/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package serveursvg;

import common.Helper;
import java.io.IOException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 *
 */
public class RmiServerSVGWriterRunner implements Runnable
{
    public void run()
    {
        try
        {
            LocateRegistry.createRegistry(1099);
            Logger.getLogger(RmiServerSVGWriterRunner.class.getName()).log(
                    Level.INFO, "RMI registry created.");
        } catch (RemoteException ex) // the RMI registry already exists
        {
            Logger.getLogger(RmiServerSVGWriterRunner.class.getName()).log(
                    Level.INFO, "The RMI registry already exists.");
        }

        try
        {
            RmiServerSvgWriter message = new RmiServerSvgWriter();
            Naming.rebind("rmi://localhost:1099/" + Helper.SVG_WRITER_RMI, message);
        } catch (IOException ex)
        {
            Logger.getLogger(RmiServerSVGWriterRunner.class.getName()).log(
                    Level.SEVERE, null, ex);
        }
    }

    public static void main(String args[])
    {
        RmiServerSVGWriterRunner rmiServerSVGWriter = new RmiServerSVGWriterRunner();
        // Running the RMI Server
        new Thread(rmiServerSVGWriter).start();
    }
}